#include <iostream>
#include <deque>

using namespace std;

const int N = 2e6 + 10;
typedef long long LL;
LL a[N];
LL f[N];
int ret[N];

int n;

int main()
{
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
		a[i + n] = a[i];
	}
	for(int i = 1; i <= 2 * n; i++) f[i] = f[i - 1] + a[i];
	int k = n;
	deque<int> q;
	for(int i = 1; i <= 2 * n; i++)
	{
		while(q.size() && f[i] <= f[q.back()]) q.pop_back();
		q.push_back(i);
		if(q.back() - q.front() + 1 > k) q.pop_front();
		if(i >= k) ret[i] = q.front();
	}
	int ans = 0;
	for(int i = 1; i <= n; i++)
	{
		if(f[ret[i + n - 1]] - f[i - 1] >= 0) ans++;
	}
	cout << ans << endl;
	return 0;
}
